<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3" xmlns:head="http://www.w3.org/1999/html">
<head th:include="public/public_css::public_css ('货品种类')"/>

<body style="background-color: #f2f2f2;">
<div class="layui-fluid larry-wrapper">
    <div class="layui-card">
        <div class="layui-row layui-col-space30">
            <div class="layui-col-xs24">
                <form class="layui-form layui-card-header  layui-card-header-auto" id="searchForm">
                    <div class="layui-inline">
                        <label class="layui-form-label">种类名称</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="mc" name="mc" placeholder="种类名称"/>
                        </div>
                    </div>
                    <div class="layui-inline inline-search-btn">
                        <a class="layui-btn layui-btn-normal search_btn" lay-event="searchEvent" data-type="reload">查询</a>
                    </div>
                    <div class="layui-inline inline-reset-btn">
                        <button type="reset" class="layui-btn layui-btn-normal" >重置</button>
                    </div>
                </form>

                <!--顶部按钮展示区域 【 tpl-button 】 -->
                <div class="group-button tpl-button" id="toolbar"></div>
                <!--列表-->
                <section class="panel panel-padding layui-card-body">
                    <div class="pro">
                        <table id="table" class="table text-nowrap"></table>
                    </div>
                </section>
            </div>
        </div>
        <!--<div id="bjEdit" style="display: none">
            <div class="layui-form-item">
                <form class="layui-form layui-card-header  layui-card-header-auto" id="formEdit">
                    <div>&nbsp;</div>
                    <div class="layui-inline">
                        <label class="layui-form-label">提起人</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="tid" name="tqrxm" placeholder="提起人"/>
                        </div>
                    </div>

                </form>
            </div>
        </div>-->
    </div>
</div>

</body>


<div th:include="public/public_js::public_js"></div>
<div th:include="public/public_btn::public_btn"></div>
<style type="text/css">
    .moreBtn {
        width: 50px;
        height: 20px;
        text-align: center;
        color: #fff;
        line-height: 20px;
        background-color: #eee;
        position: relative;
        margin: 0 auto;
        cursor: pointer;
    }

    .moreBtn:before {
        content: '';
        display: block;
        width: 35px;
        height: 20px;
        position: absolute;
        transform: skewX(30deg);
        background: #eee;
        border-top-left-radius: 8px;
        left: -20px;
        top: 0;
    }

    .moreBtn:after {
        content: '';
        display: block;
        width: 35px;
        height: 20px;
        position: absolute;
        transform: skewX(-30deg);
        background: #eee;
        border-top-right-radius: 8px;
        top: 0;
        right: -20px;
    }
</style>
<script th:inline="javascript">
    $(function () {
        $(".moreBtn").on("click", function () {
            $(".moreSearch").toggle();
        });
    });
    var functions = [[${functions}]];
    layui.use(['list', 'layer', 'zzpUtils', 'jquery', 'laydate', 'tablebutton'], function () {


        var zzpUtils = layui.zzpUtils,
            $ = layui.jquery,
            laydate = layui.laydate,
            tablebtn = layui.tablebutton;
        tablebtn.buildOnClick({
            type: 1,
            temp: $("#function_tpl"),
            functions: functions.headBtn,
            row: null,
            event: {
                searchEvent: function(){
                    console.log("点查询了");
                    zzpUtils.refreshTable("#table");
                },
                /*新增*/
                addEvent: function (data) {
                    add();
                },
            }
        });
        //初始化
        zzpUtils.webSocket.init();

        //新增
        function add() {
            zzpUtils.dialog({
                title: "新增货品种类",
                type: 2,
                content: "/Typesofgoods/Thawing",
                area: ['50%', '50%'], //设置dialog大小，也可以不设置，
                end: function () {//增加成功后刷新
                    zzpUtils.refreshTable("#table");
                }
            });
        }

        laydate.render({
            elem: '#stime'
            , theme: '#20a0ff'
        })
        laydate.render({
            elem: '#etime'
            , theme: '#20a0ff'
        })
        var $table = zzpUtils.table({
            elem: '#table',
            isApi: true,
            pagination: true,
            url: '/wmsgoodstype/list',
            columns: [
            //     {
            //     field: '',
            //     checkbox: true
            // },
                {
                field: 'mc',
                title: '种类名称',
            }, {
                field: 'sfhf',
                title: '允许混放',
                formatter: function (value, row, index) {
                    if (row.sfhf == 0) {
                        return [
                            '<a class="layui-btn layui-btn-primary layui-btn-xs" >不允许</a>'
                        ].join('')
                    } else {
                        return [
                            '<a class="layui-btn layui-btn-primary layui-btn-xs" >允许</a>'
                        ].join('')
                    }
                }
            }],
            queryParams: function () {//查询条件
                return zzpUtils.getFormJson($("#searchForm"));
            },
        });
    });
</script>
</html>